package com.example.demoday.mapper;

import com.example.demoday.pojo.User;
import org.apache.ibatis.annotations.*;

@Mapper
public interface UserMapper {

    @Insert("insert into user(username, password, nickname, email, user_pic, create_time, update_time) " +
            "values(#{username}, #{password}, #{nickname}, #{email}, #{userPic}, #{createTime}, #{updateTime})")
    void add(User user);

    @Delete("delete from user where id = #{id}")
    void del(int id);

    @Update("update user set username = #{username}, password = #{password}, nickname = #{nickname}, email = #{email}, " +
            "user_pic = #{userPic}, update_time = #{updateTime} where id = #{id}")
    void update(User user);

    @Select("select * from user where id = #{id}")
    User detail(int id);
}